import { CHECKED } from "../../../../../constants/common";

export default {
  split: com => {
    const { config } = com;

    return config.complex.filter(key => {
      return CHECKED === config[key].required
    }).map(key => {
      const subCom = config[key];

      subCom.config.required = config.required;
      subCom.config.defaultValue = subCom.value;
      
      return {
        ...subCom,
        pid: com.uuid
      };
    });
  }
};